package cn.stylefeng.guns.config.web;
import cn.stylefeng.guns.config.properties.GunsProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 静态资源映射配置
 *
 * @author xzqiang
 * @date 2018-12-12
 */
@Configuration
public class ResourceHandleConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private GunsProperties gunsProperties;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/staticpic/**").addResourceLocations("file:" + gunsProperties.getFileUploadPath());
        super.addResourceHandlers(registry);
    }

}
